﻿@model IEnumerable<SeagullConsulting.MvcAjaxControls.Data.Models.Person>
@using SeagullConsulting.MvcAjaxControls.Web.Mvc.Helpers;
@{
	ViewBag.Title = "Index";
}

<h2>AjaxGrid</h2>
<p>
	@Html.ActionLink("Add New", "Create", null, new { @class = "actionButton" })
</p>
@(Html.AjaxGridFor<SeagullConsulting.MvcAjaxControls.Data.Models.Person>()
	.WithColumns(column => {
		column.Expression("Contact Name",  p => p.Name);
		column.Expression(p => p.Address);
		column.Expression("City", p => p.City.Name);
		column.Expression("Birthday", p => p.Birthday, ColumnFormats.ShortDate);
		column.Expression(p => p.Income, ColumnFormats.Currency);
	})
	.WithActionColumns(column => {
		column.ActionLink("Details", "Details", p => p.Id);
		column.ActionLink("Edit", "Edit", p => p.Id);
		column.ActionLink("Delete", "Delete", p => p.Id);
		column.ActionLink("Phones", "ListPage", "Phone", p => p.Id);
	})
	.FromDataSource(@Url.Action("ListPerson"))
	.ToHtml()
)
<br />
@Html.ActionLink("AjaxGrid w/ pager", "ListPage")
<div id="loader" class="loader">
	<img id="img-loader" src="@Url.Content("~/Content/images/Ajax-loader.gif")" alt="Loading"/>
	</div>
<br />
